001 /* 002 * Copyright 2005 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.state; 020 021 /** 022 * Interface describing an application state. 023 * 024 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 025 * @version 1.0.0 026 */ 027 public interface State 028 { 029 /** 030 * Constant artifact type for a state graph. 031 */ 032 static final String TYPE = "state"; 033 034 /** 035 * Null state. 036 */ 037 static final State NULL_STATE = new NullState(); 038 039 /** 040 * Return the name of the state. 041 * @return the state name 042 */ 043 String getName(); 044 045 /** 046 * Set the parent state. 047 * @param state the parent state 048 */ 049 void setParent( State state ); 050 051 /** 052 * Return the parent state to this state or null if this is 053 * the root of a state graph. 054 * @return the parent state 055 */ 056 State getParent(); 057 058 /** 059 * Return the state path. The path is composed of a sequence of 060 * states from the root to this state. 061 * @return the state path 062 */ 063 State[] getStatePath(); 064 065 /** 066 * Return the substates within this state. 067 * @return the substate array 068 */ 069 State[] getStates(); 070 071 /** 072 * Return the array of triggers associated with the state. 073 * @return the trigger array 074 */ 075 Trigger[] getTriggers(); 076 077 /** 078 * Return the array of transtions associated with the state. 079 * @return the transition array 080 */ 081 Transition[] getTransitions(); 082 083 /** 084 * Return the array of operations associated with the state. 085 * @return the operation array 086 */ 087 Operation[] getOperations(); 088 089 /** 090 * Return the array of management interfaces associated with 091 * the state. 092 * @return the interfaces array 093 */ 094 Interface[] getInterfaces(); 095 096 /** 097 * Test is the state is a terminal state. 098 * @return true if terminal 099 */ 100 boolean isTerminal(); 101 }